package com.culture.config.common.filter;

import java.io.ByteArrayOutputStream;
import java.io.IOException;

import javax.servlet.ServletOutputStream;
import javax.servlet.WriteListener;

public class ServletOutputStreamWrapper extends ServletOutputStream {
    private ByteArrayOutputStream outputStream = null;
    public ServletOutputStreamWrapper(ByteArrayOutputStream stream) {
        outputStream = stream;
    }

    @Override
    public boolean isReady() {
        return true;
    }

    @Override
    public void setWriteListener(WriteListener listener) {
        throw new UnsupportedOperationException();
    }

    @Override
    public void write(int b) throws IOException {
       outputStream.write(b);
    }

	public void reset() {
        outputStream.reset();
	}

}
